<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>关键问题4</title>
</head>
<body>
<script>
    /*
        Promise链式调用
     */

    new Promise(((resolve, reject) => {
        setTimeout(() => {
            console.log('执行任务1（异步）')
            resolve(1)
        }, 1000)
    })).then(
        value => {
            console.log('任务1的结果：', value)
            console.log('执行任务2（同步）')
            resolve(2)
        }
    ).then(
        value => {
            console.log('任务2的结果：', value)
            setTimeout(() => {
                console.log('执行任务3（异步）')
            }, 1000)
        }
    )
</script>
</body>
</html>
